<template>
  <div id="app">
    <div class="top-header-nav" v-if="teacherShow">
      <img src="@/assets/img/icon-arrow-left.png" alt="" height="20" @click="$router.go(-1)">
      <span>{{ teacherTitle }}</span>
      <router-link to="/my/index">
        <img v-if="teacherInfo.head_sculpture" :src="teacherInfo.head_sculpture" alt="" height="24" width="24" style="display: block;border-radius: 50%;overflow: hidden;">
        <img v-else :src="wxAvatar ? wxAvatar : avatar" alt="" height="24" width="24" style="display: block;border-radius: 50%;overflow: hidden;">
      </router-link>
    </div>
    <div :style="{height: teacherShow ? 'calc(100% - 44px)' : '100%', 'overflow-y': 'auto'}" class="scroll-box">
      <router-view/>
    </div>
    <div class="share-cover" v-if="teacherShare">
      <img src="../../assets/img/share-cover.png" alt="" width="100%" @click="hiddenShare">
    </div>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
export default {
  name: 'App',
  data () {
    return {
      avatar: require('@/assets/img/icon-avatar.png')
    }
  },
  methods: {
    hiddenShare () {
      this.$store.commit('SET_SHARE_TEACHER', false)
    }
  },
  computed: {
    ...mapGetters([
      'teacherInfo',
      'teacherTitle',
      'teacherShow',
      'teacherShare',
      'wxAvatar'
    ])
  },
  created () {
  }
}
</script>

<style>
  *{
    margin: 0;
    padding: 0;
  }
  html, body{
    height: 100%;
    background-color: #fff;
  }
  #app {
    font-family: "PingFang SC", 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
  }
  .scroll-box{
    -webkit-overflow-scrolling: touch;
  }
  .top-header-nav{
    height: 44px;
    padding: 0 15px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #3A7FE2;
    font-size: 18px;
    font-family: PingFangBlod;
    color: #fff;
    /*position: fixed;*/
    /*width: 100%;*/
    /*top: 0;*/
    /*left: 0;*/
    /*z-index: 100;*/
  }
  .share-cover{
    background-color: rgba(0,0,0,.7);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
  }
</style>
